/*
 * Thread.cpp
 *
 *  Created on: Nov 15, 2014
 *      Author: toti
 */

#include <Threads/Thread.hpp>


Thread::Thread(){


	/* Start new thread */
	pthread_create(&pThread, 0, Thread::startThread, (void*)this);

}

Thread::~Thread(){

	std::cout << "Destructor" << std::endl;

}

void *Thread::startThread(void* object){

	Thread *thread = (Thread*)object;

	thread->run();

//	pthread_cancel(thread->pThread);

	delete(thread);

	return 0;
}


void Thread::join(){
	void *retval;
	pthread_join(pThread,&retval);
//	free(retval);
}
